home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 05.zip / BS1 part 5 / PDraw3.0.adf / pdraw_rex.lzh / StepAndRepeat.pdrx < prev    next >
Text File  |  1992-06-22  |  3KB  |  102 lines

  1. /*
  2. @N
  3.  
  4. This Genie will make multiple copies of a selection of objects with user specified offset and rotation between copies.
  5. */
  6. cr = '0a'x
  7. msg = PDSetup.rexx(2,0)
  8. units = getclip(pds_units)
  9. if msg ~= 1 then exit_msg(msg)
  10.  
  11. signal on halt
  12. signal on break_c
  13. signal on break_e
  14. signal on break_d
  15. form = "Columns"cr"Rows"cr"Gutter"
  16.  
  17. /* This Genie allows user to duplicate, move and rotate an obj
  18.  * in one step
  19.  */
  20.  
  21. obj = pdm_SelFirstObj()
  22. if obj = 0 then
  23. do
  24.  obj = pdm_ClickOnObj("Click on obj to duplicate..")
  25.  if obj = 0 then exit_msg()
  26.  pdm_SelectObj(obj)
  27. end
  28. dup = 0
  29.  
  30. objpos = pdm_GetObjVisPosn()
  31. cur_x = word(objpos, 1 )
  32. cur_y = word(objpos, 2 )
  33.  
  34. objsize = pdm_GetObjVisSize()
  35. width = word(objsize, 1 )
  36. height = word(objsize, 2 )
  37.  
  38.  
  39. if units = 3 then
  40. do
  41.    call pdm_ShowStatus("Position: " || pdm_ConvertUnits(1, 3, cur_x) || ", " || pdm_ConvertUnits(1, 3, cur_y) || " size: w" || pdm_ConvertUnits(1, 3, width) || ", h" || pdm_ConvertUnits(1, 3, height))
  42.  
  43.    form = "Count:1"cr"Horizontal offset:" || pdm_ConvertUnits(1, 3, width)||cr"Vertical offset:" || pdm_ConvertUnits(1, 3, height)||cr"Horizontal Scaling"cr"Vertical Scaling"cr"Angle"
  44.  
  45. end
  46. else
  47. do
  48.    call pdm_ShowStatus("Position: "cur_x", "cur_y" size: w"width", h"height)
  49.    form ="Count:1"cr"Horizontal offset:"width||cr"Vertical offset:"height||cr"Horizontal Scaling"cr"Vertical Scaling"cr"Angle"
  50. end
  51.  
  52. form = pdm_GetForm("Step & Repeat", 8, form)
  53. if form = '' then exit_msg()
  54. parse var form count '0a'x  horizontal '0a'x vertical '0a'x hscale '0a'x vscale '0a'x angle
  55.  
  56. if count = '' then count = 1
  57. if horizontal = '' then horizontal = 0
  58. if vertical = '' then vertical = 0
  59. if hscale = '' then hscale = 1
  60. if vscale = '' then vscale = 1
  61. if angle = '' then angle = 0
  62.  
  63. if ~(datatype(count, n) & datatype(horizontal, n) & datatype(vertical, n) & datatype(angle, n) & datatype(hscale,n) & datatype(vscale, n)) then exit_msg("Invalid Entry")
  64.  
  65. if units = 3 then
  66. do
  67.    horizontal = pdm_ConvertUnits(3, 1, horizontal)
  68.    vertical = pdm_ConvertUnits(3, 1, vertical)
  69. end
  70.  
  71. call pdm_AutoUpdate(0)
  72. rotationangle = angle
  73.  
  74. do i = 1 to count
  75.  
  76.  objpos = pdm_GetObjVisPosn(obj)
  77.  objlft = word(objpos, 1)
  78.  objtop = word(objpos, 2)
  79.  
  80.  newobj = pdm_CloneObj(,objlft,objtop,horizontal, vertical,hscale,vscale,rotationangle)
  81.  obj = newobj
  82.  
  83. end
  84.  
  85. exit_msg()
  86. break_d:
  87. break_e:
  88. break_c:
  89. halt:
  90.     call exit_msg("User aborted Genie!")
  91.  
  92. exit_msg: procedure  expose units
  93. do
  94.     parse arg message
  95.  
  96.     if message ~= '' then call pdm_Inform(1, message,)
  97.     call pdm_ClearStatus()
  98.     call pdm_SetUnits(units)
  99.     call pdm_AutoUpdate(1)
  100.     exit
  101. end
  102.